
function main( prefs, ui, hh ) {
  
  return synchUserPrefererences( prefs );
}


function synchUserPrefererences( prefs) {
  
  var a = EntityManager.getLoggedAccount();
  
  if( a == null  ) throw  "no user is logged!";
  
  var u = a.user;
   
  if( u == null  ) throw "user is not registerd!";
  
  u.setPreferences( toJSON(prefs) );
  
  EntityManager.storeUser( u );
  
  return u;
  
}
